package com.xx.sparkhbase

import org.apache.spark.sql.SparkSession

/**
 *
 *
 * @author tzp
 * @since 2022/6/20
 */
object UserFeature1 {

  case class Employee(key: String, fName: String, lName: String,
                      mName: String, addressLine: String, city: String,
                      state: String, zipCode: String)

  val data = Seq(
    Employee("1", "Abby", "Smith", "K", "3456 maint", "Orlando", "FL", "45235"),
    Employee("2", "Amaya", "Williams", "L", "123 Orange", "Newark", "NJ", "27656"),
    Employee("3", "Alchemy", "Davis", "P", "Warners", "Sanjose", "CA", "34789")
  )

  def main(args: Array[String]): Unit = {
    val spark = SparkSession.builder()
      .getOrCreate()
    val sc = spark.sparkContext
    import spark.implicits._

    def catalog =
      s"""{
         |    "table":{"namespace":"default", "name":"fe1"},
         |    "rowkey":"device_id",
         |    "columns":{
         |"device_id":{"cf":"rowkey", "col":"device_id", "type":"string"},
         |"id_type":{"cf":"c", "col":"id_type", "type": "string"},
         |"dm_0012_tt_slotid_request_times_sum_7d":{"cf":"c", "col":"dm_0012_tt_slotid_request_times_sum_7d", "type": "string"},
         |"dm_0012_tt_slotid_request_times_sum_30d":{"cf":"c", "col":"dm_0012_tt_slotid_request_times_sum_30d", "type": "string"},
         |"dm_0012_tt_slotid_show_times_sum_7d":{"cf":"c", "col":"dm_0012_tt_slotid_show_times_sum_7d", "type":     "string"},
         |"dm_0012_tt_slotid_show_times_sum_30d":{"cf":"c", "col":"dm_0012_tt_slotid_show_times_sum_30d", "type": "string"},
         |"dm_0012_tt_ctype_show_times_sum_7d":{"cf":"c", "col":"dm_0012_tt_ctype_show_times_sum_7d", "type":   "string"},
         |"dm_0012_tt_ctype_show_times_sum_30d":{"cf":"c", "col":"dm_0012_tt_ctype_show_times_sum_30d", "type":     "string"},
         |"dm_0012_tt_csite_show_times_sum_7d":{"cf":"c", "col":"dm_0012_tt_csite_show_times_sum_7d", "type":   "string"},
         |"dm_0012_tt_csite_show_times_sum_30d":{"cf":"c", "col":"dm_0012_tt_csite_show_times_sum_30d", "type":     "string"},
         |"dm_0012_tt_slotid_click_times_sum_7d":{"cf":"c", "col":"dm_0012_tt_slotid_click_times_sum_7d", "type": "string"},
         |"dm_0012_tt_slotid_click_times_sum_30d":{"cf":"c", "col":"dm_0012_tt_slotid_click_times_sum_30d", "type": "string"},
         |"dm_0012_tt_ctype_click_times_sum_7d":{"cf":"c", "col":"dm_0012_tt_ctype_click_times_sum_7d", "type":     "string"},
         |"dm_0012_tt_ctype_click_times_sum_30d":{"cf":"c", "col":"dm_0012_tt_ctype_click_times_sum_30d", "type": "string"},
         |"dm_0012_tt_csite_click_times_sum_7d":{"cf":"c", "col":"dm_0012_tt_csite_click_times_sum_7d", "type":     "string"},
         |"dm_0012_tt_csite_click_times_sum_30d":{"cf":"c", "col":"dm_0012_tt_csite_click_times_sum_30d", "type": "string"},
         |"dm_0012_ks_slotid_show_times_sum_7d":{"cf":"c", "col":"dm_0012_ks_slotid_show_times_sum_7d", "type":     "string"},
         |"dm_0012_ks_slotid_show_times_sum_30d":{"cf":"c", "col":"dm_0012_ks_slotid_show_times_sum_30d", "type": "string"},
         |"dm_0012_ks_csite_show_times_sum_7d":{"cf":"c", "col":"dm_0012_ks_csite_show_times_sum_7d", "type":   "string"},
         |"dm_0012_ks_csite_show_times_sum_30d":{"cf":"c", "col":"dm_0012_ks_csite_show_times_sum_30d", "type":     "string"},
         |"dm_0012_ks_slotid_click_times_sum_7d":{"cf":"c", "col":"dm_0012_ks_slotid_click_times_sum_7d", "type": "string"},
         |"dm_0012_ks_slotid_click_times_sum_30d":{"cf":"c", "col":"dm_0012_ks_slotid_click_times_sum_30d", "type": "string"},
         |"dm_0012_ks_csite_click_times_sum_7d":{"cf":"c", "col":"dm_0012_ks_csite_click_times_sum_7d", "type":     "string"},
         |"dm_0012_ks_csite_click_times_sum_30d":{"cf":"c", "col":"dm_0012_ks_csite_click_times_sum_30d", "type": "string"},
         |"dm_0012_ua":{"cf":"c", "col":"dm_0012_ua", "type":   "string"},
         |"dm_0012_geo":{"cf":"c", "col":"dm_0012_geo", "type":     "string"},
         |"dm_0012_model":{"cf":"c", "col":"dm_0012_model", "type": "string"},
         |"dm_0012_follow_days":{"cf":"c", "col":"dm_0012_follow_days", "type":     "string"},
         |"dm_0012_bind_days":{"cf":"c", "col":"dm_0012_bind_days", "type":    "string"},
         |"dm_0012_user_nos":{"cf":"c", "col":"dm_0012_user_nos", "type":     "string"},
         |"dm_0012_cancel_days":{"cf":"c", "col":"dm_0012_cancel_days", "type":     "string"},
         |"dm_0012_follow_state":{"cf":"c", "col":"dm_0012_follow_state", "type": "string"},
         |"dm_0012_tencent_csite_show_times_sum_7d":{"cf":"c", "col":"dm_0012_tencent_csite_show_times_sum_7d", "type": "string"},
         |"dm_0012_tencent_csite_show_times_sum_30d":{"cf":"c", "col":"dm_0012_tencent_csite_show_times_sum_30d", "type":     "string"},
         |"dm_0012_tencent_csite_click_times_sum_7d":{"cf":"c", "col":"dm_0012_tencent_csite_click_times_sum_7d", "type":     "string"},
         |"dm_0012_tencent_csite_click_times_sum_30d":{"cf":"c", "col":"dm_0012_tencent_csite_click_times_sum_30d", "type":    "string"},
         |"dm_0012_geo_show_times_sum_7d":{"cf":"c", "col":"dm_0012_geo_show_times_sum_7d", "type": "string"},
         |"dm_0012_geo_show_times_sum_30d":{"cf":"c", "col":"dm_0012_geo_show_times_sum_30d", "type":"string"},
         |"dm_0012_ip_show_times_sum_7d":{"cf":"c", "col":"dm_0012_ip_show_times_sum_7d", "type": "string"},
         |"dm_0012_ip_show_times_sum_30d":{"cf":"c", "col":"dm_0012_ip_show_times_sum_30d", "type": "string"},
         |"dm_0012_model_show_times_sum_7d":{"cf":"c", "col":"dm_0012_model_show_times_sum_7d", "type": "string"},
         |"dm_0012_model_show_times_sum_30d":{"cf":"c", "col":"dm_0012_model_show_times_sum_30d", "type":     "string"},
         |"dm_0012_tt_bid_avg_7d":{"cf":"c", "col":"dm_0012_tt_bid_avg_7d", "type": "string"},
         |"dm_0012_tt_bid_avg_30d":{"cf":"c", "col":"dm_0012_tt_bid_avg_30d", "type": "string"},
         |"dm_0008_os":{"cf":"c", "col":"dm_0008_os", "type":   "string"},
         |"dm_0008_is_register":{"cf":"c", "col":"dm_0008_is_register", "type":  "boolean"},
         |"dm_0008_register_date":{"cf":"c", "col":"dm_0008_register_date", "type": "string"},
         |"dm_0008_is_apply":{"cf":"c", "col":"dm_0008_is_apply", "type":     "boolean"},
         |"dm_0008_min_appl_date":{"cf":"c", "col":"dm_0008_min_appl_date", "type": "string"},
         |"dm_0008_max_appl_date":{"cf":"c", "col":"dm_0008_max_appl_date", "type": "string"},
         |"dm_0008_is_ps":{"cf":"c", "col":"dm_0008_is_ps", "type": "boolean"},
         |"dm_0008_min_ps_date":{"cf":"c", "col":"dm_0008_min_ps_date", "type":     "string"},
         |"dm_0008_max_ps_date":{"cf":"c", "col":"dm_0008_max_ps_date", "type":     "string"},
         |"dm_0008_request_count_1d":{"cf":"c", "col":"dm_0008_request_count_1d", "type":     "int"},
         |"dm_0008_put_count_1d":{"cf":"c", "col":"dm_0008_put_count_1d", "type": "int"},
         |"dm_0008_tt_request_count_1d":{"cf":"c", "col":"dm_0008_tt_request_count_1d", "type":  "int"},
         |"dm_0008_tt_put_count_1d":{"cf":"c", "col":"dm_0008_tt_put_count_1d", "type": "int"},
         |"dm_0008_tencent_request_count_1d":{"cf":"c", "col":"dm_0008_tencent_request_count_1d", "type":     "int"},
         |"dm_0008_tencent_put_count_1d":{"cf":"c", "col":"dm_0008_tencent_put_count_1d", "type": "int"},
         |"dm_0008_ks_request_count_1d":{"cf":"c", "col":"dm_0008_ks_request_count_1d", "type":  "int"},
         |"dm_0008_ks_put_count_1d":{"cf":"c", "col":"dm_0008_ks_put_count_1d", "type": "int"},
         |"dm_0008_imp_count_1d":{"cf":"c", "col":"dm_0008_imp_count_1d", "type": "int"},
         |"dm_0008_clk_count_1d":{"cf":"c", "col":"dm_0008_clk_count_1d", "type": "int"},
         |"dm_0008_tt_imp_count_1d":{"cf":"c", "col":"dm_0008_tt_imp_count_1d", "type": "int"},
         |"dm_0008_tt_clk_count_1d":{"cf":"c", "col":"dm_0008_tt_clk_count_1d", "type": "int"},
         |"dm_0008_tt_rta_imp_count_1d":{"cf":"c", "col":"dm_0008_tt_rta_imp_count_1d", "type":  "int"},
         |"dm_0008_tt_rta_clk_count_1d":{"cf":"c", "col":"dm_0008_tt_rta_clk_count_1d", "type":  "int"},
         |"dm_0008_tencent_imp_count_1d":{"cf":"c", "col":"dm_0008_tencent_imp_count_1d", "type": "int"},
         |"dm_0008_tencent_clk_count_1d":{"cf":"c", "col":"dm_0008_tencent_clk_count_1d", "type": "int"},
         |"dm_0008_tencent_rta_imp_count_1d":{"cf":"c", "col":"dm_0008_tencent_rta_imp_count_1d", "type":     "int"},
         |"dm_0008_tencent_rta_clk_count_1d":{"cf":"c", "col":"dm_0008_tencent_rta_clk_count_1d", "type":     "int"},
         |"dm_0008_ks_imp_count_1d":{"cf":"c", "col":"dm_0008_ks_imp_count_1d", "type": "int"},
         |"dm_0008_ks_clk_count_1d":{"cf":"c", "col":"dm_0008_ks_clk_count_1d", "type": "int"},
         |"dm_0008_ks_rta_imp_count_1d":{"cf":"c", "col":"dm_0008_ks_rta_imp_count_1d", "type":  "int"},
         |"dm_0008_ks_rta_clk_count_1d":{"cf":"c", "col":"dm_0008_ks_rta_clk_count_1d", "type":  "int"},
         |"dm_0008_request_count_3d":{"cf":"c", "col":"dm_0008_request_count_3d", "type":     "int"},
         |"dm_0008_put_count_3d":{"cf":"c", "col":"dm_0008_put_count_3d", "type": "int"},
         |"dm_0008_tt_request_count_3d":{"cf":"c", "col":"dm_0008_tt_request_count_3d", "type":  "int"},
         |"dm_0008_tt_put_count_3d":{"cf":"c", "col":"dm_0008_tt_put_count_3d", "type": "int"},
         |"dm_0008_tencent_request_count_3d":{"cf":"c", "col":"dm_0008_tencent_request_count_3d", "type":     "int"},
         |"dm_0008_tencent_put_count_3d":{"cf":"c", "col":"dm_0008_tencent_put_count_3d", "type": "int"},
         |"dm_0008_ks_request_count_3d":{"cf":"c", "col":"dm_0008_ks_request_count_3d", "type":  "int"},
         |"dm_0008_ks_put_count_3d":{"cf":"c", "col":"dm_0008_ks_put_count_3d", "type": "int"},
         |"dm_0008_imp_count_3d":{"cf":"c", "col":"dm_0008_imp_count_3d", "type": "int"},
         |"dm_0008_clk_count_3d":{"cf":"c", "col":"dm_0008_clk_count_3d", "type": "int"},
         |"dm_0008_tt_imp_count_3d":{"cf":"c", "col":"dm_0008_tt_imp_count_3d", "type": "int"},
         |"dm_0008_tt_clk_count_3d":{"cf":"c", "col":"dm_0008_tt_clk_count_3d", "type": "int"},
         |"dm_0008_tt_rta_imp_count_3d":{"cf":"c", "col":"dm_0008_tt_rta_imp_count_3d", "type":  "int"},
         |"dm_0008_tt_rta_clk_count_3d":{"cf":"c", "col":"dm_0008_tt_rta_clk_count_3d", "type":  "int"},
         |"dm_0008_tencent_imp_count_3d":{"cf":"c", "col":"dm_0008_tencent_imp_count_3d", "type": "int"},
         |"dm_0008_tencent_clk_count_3d":{"cf":"c", "col":"dm_0008_tencent_clk_count_3d", "type": "int"},
         |"dm_0008_tencent_rta_imp_count_3d":{"cf":"c", "col":"dm_0008_tencent_rta_imp_count_3d", "type":     "int"},
         |"dm_0008_tencent_rta_clk_count_3d":{"cf":"c", "col":"dm_0008_tencent_rta_clk_count_3d", "type":     "int"},
         |"dm_0008_ks_imp_count_3d":{"cf":"c", "col":"dm_0008_ks_imp_count_3d", "type": "int"},
         |"dm_0008_ks_clk_count_3d":{"cf":"c", "col":"dm_0008_ks_clk_count_3d", "type": "int"},
         |"dm_0008_ks_rta_imp_count_3d":{"cf":"c", "col":"dm_0008_ks_rta_imp_count_3d", "type":  "int"},
         |"dm_0008_ks_rta_clk_count_3d":{"cf":"c", "col":"dm_0008_ks_rta_clk_count_3d", "type":  "int"},
         |"dm_0008_request_count_1w":{"cf":"c", "col":"dm_0008_request_count_1w", "type":     "int"},
         |"dm_0008_put_count_1w":{"cf":"c", "col":"dm_0008_put_count_1w", "type": "int"},
         |"dm_0008_tt_request_count_1w":{"cf":"c", "col":"dm_0008_tt_request_count_1w", "type":  "int"},
         |"dm_0008_tt_put_count_1w":{"cf":"c", "col":"dm_0008_tt_put_count_1w", "type": "int"},
         |"dm_0008_tencent_request_count_1w":{"cf":"c", "col":"dm_0008_tencent_request_count_1w", "type":     "int"},
         |"dm_0008_tencent_put_count_1w":{"cf":"c", "col":"dm_0008_tencent_put_count_1w", "type": "int"},
         |"dm_0008_ks_request_count_1w":{"cf":"c", "col":"dm_0008_ks_request_count_1w", "type":  "int"},
         |"dm_0008_ks_put_count_1w":{"cf":"c", "col":"dm_0008_ks_put_count_1w", "type": "int"},
         |"dm_0008_imp_count_1w":{"cf":"c", "col":"dm_0008_imp_count_1w", "type": "int"},
         |"dm_0008_clk_count_1w":{"cf":"c", "col":"dm_0008_clk_count_1w", "type": "int"},
         |"dm_0008_tt_imp_count_1w":{"cf":"c", "col":"dm_0008_tt_imp_count_1w", "type": "int"},
         |"dm_0008_tt_clk_count_1w":{"cf":"c", "col":"dm_0008_tt_clk_count_1w", "type": "int"},
         |"dm_0008_tt_rta_imp_count_1w":{"cf":"c", "col":"dm_0008_tt_rta_imp_count_1w", "type":  "int"},
         |"dm_0008_tt_rta_clk_count_1w":{"cf":"c", "col":"dm_0008_tt_rta_clk_count_1w", "type":  "int"},
         |"dm_0008_tencent_imp_count_1w":{"cf":"c", "col":"dm_0008_tencent_imp_count_1w", "type": "int"},
         |"dm_0008_tencent_clk_count_1w":{"cf":"c", "col":"dm_0008_tencent_clk_count_1w", "type": "int"},
         |"dm_0008_tencent_rta_imp_count_1w":{"cf":"c", "col":"dm_0008_tencent_rta_imp_count_1w", "type":     "int"},
         |"dm_0008_tencent_rta_clk_count_1w":{"cf":"c", "col":"dm_0008_tencent_rta_clk_count_1w", "type":     "int"},
         |"dm_0008_ks_imp_count_1w":{"cf":"c", "col":"dm_0008_ks_imp_count_1w", "type": "int"},
         |"dm_0008_ks_clk_count_1w":{"cf":"c", "col":"dm_0008_ks_clk_count_1w", "type": "int"},
         |"dm_0008_ks_rta_imp_count_1w":{"cf":"c", "col":"dm_0008_ks_rta_imp_count_1w", "type":  "int"},
         |"dm_0008_ks_rta_clk_count_1w":{"cf":"c", "col":"dm_0008_ks_rta_clk_count_1w", "type":  "int"},
         |"dm_0008_request_count_2w":{"cf":"c", "col":"dm_0008_request_count_2w", "type":     "int"},
         |"dm_0008_put_count_2w":{"cf":"c", "col":"dm_0008_put_count_2w", "type": "int"},
         |"dm_0008_tt_request_count_2w":{"cf":"c", "col":"dm_0008_tt_request_count_2w", "type":  "int"},
         |"dm_0008_tt_put_count_2w":{"cf":"c", "col":"dm_0008_tt_put_count_2w", "type": "int"},
         |"dm_0008_tencent_request_count_2w":{"cf":"c", "col":"dm_0008_tencent_request_count_2w", "type":     "int"},
         |"dm_0008_tencent_put_count_2w":{"cf":"c", "col":"dm_0008_tencent_put_count_2w", "type": "int"},
         |"dm_0008_ks_request_count_2w":{"cf":"c", "col":"dm_0008_ks_request_count_2w", "type":  "int"},
         |"dm_0008_ks_put_count_2w":{"cf":"c", "col":"dm_0008_ks_put_count_2w", "type": "int"},
         |"dm_0008_imp_count_2w":{"cf":"c", "col":"dm_0008_imp_count_2w", "type": "int"},
         |"dm_0008_clk_count_2w":{"cf":"c", "col":"dm_0008_clk_count_2w", "type": "int"},
         |"dm_0008_tt_imp_count_2w":{"cf":"c", "col":"dm_0008_tt_imp_count_2w", "type": "int"},
         |"dm_0008_tt_clk_count_2w":{"cf":"c", "col":"dm_0008_tt_clk_count_2w", "type": "int"},
         |"dm_0008_tt_rta_imp_count_2w":{"cf":"c", "col":"dm_0008_tt_rta_imp_count_2w", "type":  "int"},
         |"dm_0008_tt_rta_clk_count_2w":{"cf":"c", "col":"dm_0008_tt_rta_clk_count_2w", "type":  "int"},
         |"dm_0008_tencent_imp_count_2w":{"cf":"c", "col":"dm_0008_tencent_imp_count_2w", "type": "int"},
         |"dm_0008_tencent_clk_count_2w":{"cf":"c", "col":"dm_0008_tencent_clk_count_2w", "type": "int"},
         |"dm_0008_tencent_rta_imp_count_2w":{"cf":"c", "col":"dm_0008_tencent_rta_imp_count_2w", "type":     "int"},
         |"dm_0008_tencent_rta_clk_count_2w":{"cf":"c", "col":"dm_0008_tencent_rta_clk_count_2w", "type":     "int"},
         |"dm_0008_ks_imp_count_2w":{"cf":"c", "col":"dm_0008_ks_imp_count_2w", "type": "int"},
         |"dm_0008_ks_clk_count_2w":{"cf":"c", "col":"dm_0008_ks_clk_count_2w", "type": "int"},
         |"dm_0008_ks_rta_imp_count_2w":{"cf":"c", "col":"dm_0008_ks_rta_imp_count_2w", "type":  "int"},
         |"dm_0008_ks_rta_clk_count_2w":{"cf":"c", "col":"dm_0008_ks_rta_clk_count_2w", "type":  "int"},
         |"dm_0008_request_count_1m":{"cf":"c", "col":"dm_0008_request_count_1m", "type":     "int"},
         |"dm_0008_put_count_1m":{"cf":"c", "col":"dm_0008_put_count_1m", "type": "int"},
         |"dm_0008_tt_request_count_1m":{"cf":"c", "col":"dm_0008_tt_request_count_1m", "type":  "int"},
         |"dm_0008_tt_put_count_1m":{"cf":"c", "col":"dm_0008_tt_put_count_1m", "type": "int"},
         |"dm_0008_tencent_request_count_1m":{"cf":"c", "col":"dm_0008_tencent_request_count_1m", "type":     "int"},
         |"dm_0008_tencent_put_count_1m":{"cf":"c", "col":"dm_0008_tencent_put_count_1m", "type": "int"},
         |"dm_0008_ks_request_count_1m":{"cf":"c", "col":"dm_0008_ks_request_count_1m", "type":  "int"},
         |"dm_0008_ks_put_count_1m":{"cf":"c", "col":"dm_0008_ks_put_count_1m", "type": "int"},
         |"dm_0008_imp_count_1m":{"cf":"c", "col":"dm_0008_imp_count_1m", "type": "int"},
         |"dm_0008_clk_count_1m":{"cf":"c", "col":"dm_0008_clk_count_1m", "type": "int"},
         |"dm_0008_tt_imp_count_1m":{"cf":"c", "col":"dm_0008_tt_imp_count_1m", "type": "int"},
         |"dm_0008_tt_clk_count_1m":{"cf":"c", "col":"dm_0008_tt_clk_count_1m", "type": "int"},
         |"dm_0008_tt_rta_imp_count_1m":{"cf":"c", "col":"dm_0008_tt_rta_imp_count_1m", "type":  "int"},
         |"dm_0008_tt_rta_clk_count_1m":{"cf":"c", "col":"dm_0008_tt_rta_clk_count_1m", "type":  "int"},
         |"dm_0008_tencent_imp_count_1m":{"cf":"c", "col":"dm_0008_tencent_imp_count_1m", "type": "int"},
         |"dm_0008_tencent_clk_count_1m":{"cf":"c", "col":"dm_0008_tencent_clk_count_1m", "type": "int"},
         |"dm_0008_tencent_rta_imp_count_1m":{"cf":"c", "col":"dm_0008_tencent_rta_imp_count_1m", "type":     "int"},
         |"dm_0008_tencent_rta_clk_count_1m":{"cf":"c", "col":"dm_0008_tencent_rta_clk_count_1m", "type":     "int"},
         |"dm_0008_ks_imp_count_1m":{"cf":"c", "col":"dm_0008_ks_imp_count_1m", "type": "int"},
         |"dm_0008_ks_clk_count_1m":{"cf":"c", "col":"dm_0008_ks_clk_count_1m", "type": "int"},
         |"dm_0008_ks_rta_imp_count_1m":{"cf":"c", "col":"dm_0008_ks_rta_imp_count_1m", "type":  "int"},
         |"dm_0008_ks_rta_clk_count_1m":{"cf":"c", "col":"dm_0008_ks_rta_clk_count_1m", "type":  "int"},
         |"pday":{"cf":"c", "col":"pday", "type": "string"}
         |    }
         |}
         |""".stripMargin

    val df = spark.sql(
      """select
        | device_id,
        |id_type,
        |dm_0012_tt_slotid_request_times_sum_7d,
        |dm_0012_tt_slotid_request_times_sum_30d,
        |dm_0012_tt_slotid_show_times_sum_7d,
        |dm_0012_tt_slotid_show_times_sum_30d,
        |dm_0012_tt_ctype_show_times_sum_7d,
        |dm_0012_tt_ctype_show_times_sum_30d,
        |dm_0012_tt_csite_show_times_sum_7d,
        |dm_0012_tt_csite_show_times_sum_30d,
        |dm_0012_tt_slotid_click_times_sum_7d,
        |dm_0012_tt_slotid_click_times_sum_30d,
        |dm_0012_tt_ctype_click_times_sum_7d,
        |dm_0012_tt_ctype_click_times_sum_30d,
        |dm_0012_tt_csite_click_times_sum_7d,
        |dm_0012_tt_csite_click_times_sum_30d,
        |dm_0012_ks_slotid_show_times_sum_7d,
        |dm_0012_ks_slotid_show_times_sum_30d,
        |dm_0012_ks_csite_show_times_sum_7d,
        |dm_0012_ks_csite_show_times_sum_30d,
        |dm_0012_ks_slotid_click_times_sum_7d,
        |dm_0012_ks_slotid_click_times_sum_30d,
        |dm_0012_ks_csite_click_times_sum_7d,
        |dm_0012_ks_csite_click_times_sum_30d,
        |dm_0012_ua,
        |dm_0012_geo,
        |dm_0012_model,
        |dm_0012_follow_days,
        |dm_0012_bind_days,
        |dm_0012_user_nos,
        |dm_0012_cancel_days,
        |dm_0012_follow_state,
        |dm_0012_tencent_csite_show_times_sum_7d,
        |dm_0012_tencent_csite_show_times_sum_30d,
        |dm_0012_tencent_csite_click_times_sum_7d,
        |dm_0012_tencent_csite_click_times_sum_30d,
        |dm_0012_geo_show_times_sum_7d,
        |dm_0012_geo_show_times_sum_30d,
        |dm_0012_ip_show_times_sum_7d,
        |dm_0012_ip_show_times_sum_30d,
        |dm_0012_model_show_times_sum_7d,
        |dm_0012_model_show_times_sum_30d,
        |dm_0012_tt_bid_avg_7d,
        |dm_0012_tt_bid_avg_30d,
        |dm_0008_os,
        |dm_0008_is_register,
        |date_format(dm_0008_register_date, 'yyyy-MM-dd') as dm_0008_register_date,
        |dm_0008_is_apply,
        |date_format(dm_0008_min_appl_date, 'yyyy-MM-dd') as dm_0008_min_appl_date,
        |date_format(dm_0008_max_appl_date, 'yyyy-MM-dd') as dm_0008_max_appl_date,
        |dm_0008_is_ps,
        |date_format(dm_0008_min_ps_date, 'yyyy-MM-dd') as dm_0008_min_ps_date,
        |date_format(dm_0008_max_ps_date, 'yyyy-MM-dd') as dm_0008_max_ps_date,
        |dm_0008_request_count_1d,
        |dm_0008_put_count_1d,
        |dm_0008_tt_request_count_1d,
        |dm_0008_tt_put_count_1d,
        |dm_0008_tencent_request_count_1d,
        |dm_0008_tencent_put_count_1d,
        |dm_0008_ks_request_count_1d,
        |dm_0008_ks_put_count_1d,
        |dm_0008_imp_count_1d,
        |dm_0008_clk_count_1d,
        |dm_0008_tt_imp_count_1d,
        |dm_0008_tt_clk_count_1d,
        |dm_0008_tt_rta_imp_count_1d,
        |dm_0008_tt_rta_clk_count_1d,
        |dm_0008_tencent_imp_count_1d,
        |dm_0008_tencent_clk_count_1d,
        |dm_0008_tencent_rta_imp_count_1d,
        |dm_0008_tencent_rta_clk_count_1d,
        |dm_0008_ks_imp_count_1d,
        |dm_0008_ks_clk_count_1d,
        |dm_0008_ks_rta_imp_count_1d,
        |dm_0008_ks_rta_clk_count_1d,
        |dm_0008_request_count_3d,
        |dm_0008_put_count_3d,
        |dm_0008_tt_request_count_3d,
        |dm_0008_tt_put_count_3d,
        |dm_0008_tencent_request_count_3d,
        |dm_0008_tencent_put_count_3d,
        |dm_0008_ks_request_count_3d,
        |dm_0008_ks_put_count_3d,
        |dm_0008_imp_count_3d,
        |dm_0008_clk_count_3d,
        |dm_0008_tt_imp_count_3d,
        |dm_0008_tt_clk_count_3d,
        |dm_0008_tt_rta_imp_count_3d,
        |dm_0008_tt_rta_clk_count_3d,
        |dm_0008_tencent_imp_count_3d,
        |dm_0008_tencent_clk_count_3d,
        |dm_0008_tencent_rta_imp_count_3d,
        |dm_0008_tencent_rta_clk_count_3d,
        |dm_0008_ks_imp_count_3d,
        |dm_0008_ks_clk_count_3d,
        |dm_0008_ks_rta_imp_count_3d,
        |dm_0008_ks_rta_clk_count_3d,
        |dm_0008_request_count_1w,
        |dm_0008_put_count_1w,
        |dm_0008_tt_request_count_1w,
        |dm_0008_tt_put_count_1w,
        |dm_0008_tencent_request_count_1w,
        |dm_0008_tencent_put_count_1w,
        |dm_0008_ks_request_count_1w,
        |dm_0008_ks_put_count_1w,
        |dm_0008_imp_count_1w,
        |dm_0008_clk_count_1w,
        |dm_0008_tt_imp_count_1w,
        |dm_0008_tt_clk_count_1w,
        |dm_0008_tt_rta_imp_count_1w,
        |dm_0008_tt_rta_clk_count_1w,
        |dm_0008_tencent_imp_count_1w,
        |dm_0008_tencent_clk_count_1w,
        |dm_0008_tencent_rta_imp_count_1w,
        |dm_0008_tencent_rta_clk_count_1w,
        |dm_0008_ks_imp_count_1w,
        |dm_0008_ks_clk_count_1w,
        |dm_0008_ks_rta_imp_count_1w,
        |dm_0008_ks_rta_clk_count_1w,
        |dm_0008_request_count_2w,
        |dm_0008_put_count_2w,
        |dm_0008_tt_request_count_2w,
        |dm_0008_tt_put_count_2w,
        |dm_0008_tencent_request_count_2w,
        |dm_0008_tencent_put_count_2w,
        |dm_0008_ks_request_count_2w,
        |dm_0008_ks_put_count_2w,
        |dm_0008_imp_count_2w,
        |dm_0008_clk_count_2w,
        |dm_0008_tt_imp_count_2w,
        |dm_0008_tt_clk_count_2w,
        |dm_0008_tt_rta_imp_count_2w,
        |dm_0008_tt_rta_clk_count_2w,
        |dm_0008_tencent_imp_count_2w,
        |dm_0008_tencent_clk_count_2w,
        |dm_0008_tencent_rta_imp_count_2w,
        |dm_0008_tencent_rta_clk_count_2w,
        |dm_0008_ks_imp_count_2w,
        |dm_0008_ks_clk_count_2w,
        |dm_0008_ks_rta_imp_count_2w,
        |dm_0008_ks_rta_clk_count_2w,
        |dm_0008_request_count_1m,
        |dm_0008_put_count_1m,
        |dm_0008_tt_request_count_1m,
        |dm_0008_tt_put_count_1m,
        |dm_0008_tencent_request_count_1m,
        |dm_0008_tencent_put_count_1m,
        |dm_0008_ks_request_count_1m,
        |dm_0008_ks_put_count_1m,
        |dm_0008_imp_count_1m,
        |dm_0008_clk_count_1m,
        |dm_0008_tt_imp_count_1m,
        |dm_0008_tt_clk_count_1m,
        |dm_0008_tt_rta_imp_count_1m,
        |dm_0008_tt_rta_clk_count_1m,
        |dm_0008_tencent_imp_count_1m,
        |dm_0008_tencent_clk_count_1m,
        |dm_0008_tencent_rta_imp_count_1m,
        |dm_0008_tencent_rta_clk_count_1m,
        |dm_0008_ks_imp_count_1m,
        |dm_0008_ks_clk_count_1m,
        |dm_0008_ks_rta_imp_count_1m,
        |dm_0008_ks_rta_clk_count_1m,
        |pday
        | from dp_data_db.feature_all_device_dm_001 where pday='20220526' and device_id is not null
        |""".stripMargin)

    //这个connector玩具性质东西?? 不支持date类型.
    //import org.apache.hadoop.hbase.spark.datasources.{HBaseSparkConf, HBaseTableCatalog}
//    df.write.options(
//      Map(HBaseTableCatalog.tableCatalog -> catalog,
//        HBaseTableCatalog.newTable -> "4",
//        HBaseSparkConf.USE_HBASECONTEXT -> "false"
//      )
//    ).format("org.apache.hadoop.hbase.spark").save()

  }
}
